package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.DigitalCollectionProductInfoAuction;
import com.sc.nft.entity.DigitalCollectionProductInfoAuctionUserAgreement;
import com.sc.nft.entity.dto.AuctionRecordAdminDTO;
import com.sc.nft.entity.vo.AuctionRecordAdminPageVO;
import com.sc.nft.mapper.DigitalCollectionProductInfoAuctionMapper;
import com.sc.nft.mapper.DigitalCollectionProductInfoAuctionUserAgreementMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;


@Slf4j
@Repository
public class DigitalCollectionProductInfoAuctionUserAgreementDao extends ServiceImpl<DigitalCollectionProductInfoAuctionUserAgreementMapper, DigitalCollectionProductInfoAuctionUserAgreement> {

    public int countByProductIdAndUserId(Long productId, Long userId) {
        LambdaQueryWrapper<DigitalCollectionProductInfoAuctionUserAgreement> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DigitalCollectionProductInfoAuctionUserAgreement::getProductId,productId);
        queryWrapper.eq(DigitalCollectionProductInfoAuctionUserAgreement::getUserId,userId);
        return count(queryWrapper);
    }
}
